<?php
/**
 * Created by PhpStorm.
 * User: tjjs
 * Date: 17-6-19
 * Time: 下午1:44
 */

namespace ActionsHttp;

use Data\Tree_species_DAO;

class SpeciesList extends BaseActionHttp
{
    public function doAction() {
        parent::doAction();
        $customer_id_random_str = $this->data[CUSTOMER_ID];
        $customer_id = substr($customer_id_random_str,10);
        // 检测登陆是否过期
        if (!($this->checkSession($customer_id))) {
            return;
        }

        // 浏览页码
        $page_number = $this->data[PAGE_NUM];
        // 每页显示条数
        $every_page_counts = $this->data[EVERY_PAGE_COUNTS];
        // 模糊搜索(花木品种名称)
        $name_index = $this->data[NAME_INDEX];
        // 列表起始值
        $list_start = ($page_number-1)*$every_page_counts;

        $species_list = Tree_species_DAO::getPageList($name_index,$list_start,$every_page_counts);


        // 返回数据
        $this->setValue(SPECIES_LIST,$species_list);
        $this->ResponseDataToCurrentClient();

    }
}